home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / INFO / DOS40DSK.ZIP / DOS40DSK.TXT
Text File  |  1990-03-30  |  6KB  |  130 lines

  1.  
  2.  
  3.                         DOS 4.0 Large File Support
  4.  
  5.  
  6.         I was curious about the way DOS 4.0 allocates and locates
  7.         data on large fixed-disks. During my research I found several
  8.         interesting points.
  9.  
  10.         I had heard that the File Allocation Table (FAT) entries
  11.         were now 32 bits long. This did not turn out to be the
  12.         case. The entries are still 16 bits. The space allocated
  13.         to the FAT did increase to 64K.
  14.  
  15.         One thing that changed is the Master Boot Record Partition
  16.         Table. This is what ROM BIOS reads to find the
  17.         "Bootable Partition" on the fixed-disk. The "System Indicator
  18.         Byte" is now 06H which was "Reserved for future use" in earlier
  19.         versions of DOS. The System Indicator Byte is used to determine
  20.         the way the fixed disk is partitioned.
  21.         After talking with one of the developers that
  22.         helped write FDISK for DOS 4.0, I found out that the 06H
  23.         indicates one of two things. If the primary partition is
  24.         greater than 32MB or if the primary partition extends past
  25.         the 32MB boundary 06H is used as the system indicator so
  26.         earlier DOS versions will not try to read the disk.
  27.         This is necessary because earlier versions of DOS are not
  28.         capable of accessing disks larger that 32MB. Earlier versions
  29.         of DOS use one word (16 bits) to access logical sectors.
  30.  
  31.         The next thing that changed is the Boot Record. Programs
  32.         that use the Boot Record to calculate disk access must be
  33.         able to read the DOS 4.0 Boot Record to work properly.
  34.         In the earlier versions of DOS at offset 13H of
  35.         the Boot Record was a word (2 bytes) that indicated how
  36.         many sectors were on the fixed-disk. When DOS 4.0
  37.         FDISK is executed, it calculates the total number of sectors.
  38.         If that number is greater than FFFFH (64K), a zero is placed
  39.         at offset 13H of the Boot Record. The total number of sectors
  40.         is placed in a double-word (4 bytes) at offset 20H of the
  41.         Boot Record. Programs that do not know this think that there
  42.         is only one sector on the fixed disk (zero based). So, all of
  43.         their calculation for finding the FAT and Root Directory are
  44.         wrong. Newer versions of this type of program should know how
  45.         to read the additional information in the Boot Record.
  46.  
  47.         One other important thing that changed is the cluster size.
  48.         A cluster is the way DOS allocates space on the disk.
  49.         ROM BIOS (Interrupt 13H) accesses space on the disk in sectors
  50.         which consist of 512 bytes each. With DOS 4.0 we now have
  51.         "variable cluster size". When a fixed disk is between
  52.         32MB and 128MB the cluster size is four sectors per cluster.
  53.         As the size of the fixed disk increases so does the
  54.         cluster size up to a maximum of 128 sectors per cluster.
  55.  
  56.  
  57.         Here is why:
  58.                      1 sector = 512 bytes
  59.  
  60.                      FFFFH = 64K (65536) clusters possible in 16 bit FAT
  61.  
  62.                      4 sectors per cluster = 2048 bytes per cluster
  63.  
  64.                      2048 * 65536 = 134217728 bytes (128MB)
  65.  
  66.                                     or
  67.  
  68.                      128 sector per cluster = 65536 bytes per cluster
  69.  
  70.                      65536 * 65536 =  4294967296 (4096MB)
  71.  
  72.         As the size of the disk increases the cluster size must increase
  73.         since the 16 bit FAT entries are constant.
  74.  
  75.         The important thing to remember is that if you have very large
  76.         files on a very large disk you will realize the advantage of
  77.         having one large "C" drive. But, if you have several small files
  78.         you should partition your very large drive into several 32MB
  79.         drives.
  80.         Here is why:
  81.  
  82.                         Suppose you had a 130MB fixed-disk.
  83.                         The cluster size would be eight
  84.                         sectors per cluster.
  85.                         8 * 512 = 4096 bytes (4K)
  86.  
  87.                         The smallest unit DOS can allocate
  88.                         on the disk is a cluster.
  89.  
  90.                         A file of 4000000 bytes would use
  91.                         most of the space allotted.
  92.  
  93.                         A file of 1096 bytes would waste
  94.                         3000 bytes of disk space.
  95.                         The same file on a 32MB disk would
  96.                         waste only 952 bytes.
  97.  
  98.  
  99.  
  100.  
  101.  
  102.         Now let's discuss these 32 bit entries we've heard about
  103.         for accessing the fixed-disk.
  104.  
  105.         These entries come from the DOS 4.0 Absolute Disk Read
  106.         and Disk Write Services (Interrupt 25H and 26H).
  107.  
  108.         DOS views the disk as logical sectors from 0 to a
  109.         maximum of FFFFFFFFH (4294967296). By the way, that means
  110.         DOS 4.0 has a maximum fixed-disk size of
  111.         (512 bytes per sector * 4294967296) 2199023255552 bytes
  112.         (2GB).
  113.         WOW!
  114.  
  115.         When a program requests a sector it gives DOS 4.0 a
  116.         logical sector number 32 bits long. DOS 4.0 converts
  117.         the number to give the program the sector it requested.
  118.  
  119.         It is curious to note that DOS 4.0 has the capacity
  120.         to access much larger disks than the current
  121.         implementation of 128 sector per cluster maximum.
  122.  
  123.         I hope this clears up some of the questions about
  124.         the way DOS 4.0 accesses the fixed disk.                        
  125.  
  126.  
  127.                                               Wyn Easton
  128.                                               IBM Marketing Support Rep.
  129.  
  130.